//
//  ListTableViewCell.m
//  10-homeWork-YICheCell
//
//  Created by 王道林 on 16/7/27.
//  Copyright © 2016年 王道林. All rights reserved.
//

#import "ListTableViewCell.h"
#import "UIImageView+WebCache.h"
@implementation ListTableViewCell


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createSubView];
    }
    return self;
}

- (void)createSubView
{
    _iamgeView = [[UIImageView alloc] init];
//    _iamgeView.backgroundColor = [UIColor redColor];
    [self.contentView addSubview:_iamgeView];
    
    _lable = [[UILabel alloc] init];
//    _lable.backgroundColor = [UIColor blueColor];
    [self.contentView addSubview:_lable];
}


- (void)layoutSubviews
{
    [super layoutSubviews];
    _iamgeView.frame = CGRectMake(3, 6, self.contentView.frame.size.width / 4, self.contentView.frame.size.height - 12);
    _lable.frame = CGRectMake(self.contentView.frame.size.width / 4 - 3, 6, self.contentView.frame.size.width * 3 / 4 + 3, self.contentView.frame.size.height - 12);
}


- (void)setModel:(ModelOfList *)model
{
    _model = model;
    [_iamgeView sd_setImageWithURL:[NSURL URLWithString:_model.picCover] placeholderImage:[UIImage imageNamed:@"1"]];
    
    _lable.text = _model.title;
}



- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
